#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back

using namespace std;

using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;
using ll = long long;
using db = double;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

char s[5][20];
char t[1010];

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
	for(int i = 1;i <= 3;i++) scanf("%s", s[i] + 1);
	scanf("%s", t + 1); int l = strlen(t + 1);
	for(int i = 1; i <= l; i++) {
		cout << s[t[i] - '0'] + 1;
	}
}
